package edu.sctu.wulixia.month6.day20150606.Check;

import edu.sctu.wulixia.month6.day20150606.Data.SetTrainData;
import edu.sctu.wulixia.month6.day20150606.PeopleInfo.PeopleAppbean;

import java.util.HashMap;

/**
 * Created by user05 on 2015/6/6.
 */

//地铁卡处理

public class CheckCard {
    private HashMap<String, Integer> map;

    public CheckCard() {
        map = new SetTrainData().setHashMapData();
    }

    public void getCard(String start, String end) {



    }

    public int getCount(String start, String end) {
        int count;
        count = Math.abs(map.get(start) - map.get(end));
        return count;
    }

    public int getPrice(String start, String end) {
        int price = 2;
        if (getCount(start, end) < 3) {
            price = 2;
        } else if (getCount(start, end) >= 3 ) {
            price = 4;
        } else if (getCount(start, end) >= 6 ) {
            price = 5;
        } else if (getCount(start, end) >= 8) {
            price = 6;
        }
        return price;
    }

    /**
     * 充值金额
     *
     * @param price
     */
    public void setPrice(int price,PeopleAppbean people){

        people.setPrice(people.getPrice() + price);
    }
}
